package com.bawei.module_mine.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.bawei.module_mine.R
import com.bawei.module_mine.databinding.ItemHelpBinding
import com.bawei.module_mine.model.HelpModel

class HelpAdapter(val data : List<HelpModel>) : RecyclerView.Adapter<HelpAdapter.HelpViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HelpViewHolder {
        val itemDataBinding = ItemHelpBinding.inflate(LayoutInflater.from(parent.context),parent,false)
        return HelpViewHolder(itemDataBinding)
    }


    override fun getItemCount(): Int {
        return data.size
    }

    override fun onBindViewHolder(holder: HelpViewHolder, position: Int) {
        val itemData = data[position]
        holder.itemView.findViewById<TextView>(R.id.tv_status).setText(itemData.title)
        holder.itemView.findViewById<TextView>(R.id.tv_desc).setText(itemData.desc)
        if (holder.itemView.findViewById<TextView>(R.id.tv_desc).text.equals("")){
            holder.itemView.findViewById<TextView>(R.id.tv_desc).visibility = View.GONE
        }
    }


    class HelpViewHolder(val itemView:ItemHelpBinding) : RecyclerView.ViewHolder(itemView.root)

}




































